package com.atguigu.controller;


import com.atguigu.login.TingShuLogin;
import com.atguigu.minio.MinIoUploader;
import com.atguigu.result.RetVal;
import com.atguigu.util.AuthContextHolder;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p>
 * 一级分类表 前端控制器
 * </p>
 *
 * @author Joe
 * @since 2024-11-15
 */
@Tag(name = "上传管理")
@RestController
@RequestMapping("/api/album")
public class FileUploadController {

    @Autowired
    private MinIoUploader minIoUploader;
    @Operation(summary = "文件上传")
    @PostMapping("/fileUpload")
    public RetVal fileUpload(MultipartFile file) throws Exception {
        String retUrl = minIoUploader.uploadFile(file);
        return RetVal.ok(retUrl);
    }
}
